package com.edfu.core.dyna.vo;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Value implements Serializable {
	private static final long serialVersionUID = 2125770875031840919L;
	private static String STRING = "string";
	private static String INT = "int";
	private static String DATE = "date";	
	private static String LONG = "long";
	private static String DOUBLE = "double";

	public String name;
	private Date dateValue;
	private String stringValue;
	private int intValue;
	private long longValue;
	private Double doubleValue;
	public String type;
	private String value;

	public Value() {
	}

	public Value(String name, String value) {
		this.name = name;
		this.stringValue = value;
		this.value = value;
		this.type = STRING;
	}

	public Value(String name, Date value) {
		DateFormat formater = new SimpleDateFormat("EEE MMM dd kk:mm:ss.SSS z yyyy");
		this.name = name;
		this.dateValue = value;
		this.value = formater.format(value);
		this.type = DATE;
	}

	public Value(String name, int value) {
		this.name = name;
		this.intValue = value;
		this.value = Integer.valueOf(getIntValue()).toString();
		this.type = INT;
	}

	public Value(String name, long value) {
		this.name = name;
		this.longValue = value;
		this.value = Long.valueOf(getLongValue()).toString();
		this.type = LONG;
	}
	
	public Value(String name, Double value) {
		this.name = name;
		this.doubleValue = value;
		this.value = Double.valueOf(getDoubleValue()).toString();
		this.type = DOUBLE;
	}

	public String getValue() {
		return value;
	}

	public String getName() {
		return name;
	}

	public int getIntValue() {
		return intValue;
	}

	public long getLongValue() {
		return longValue;
	}

	public String getStringValue() {
		return stringValue;
	}

	public Date getDateValue() {
		return dateValue;
	}

	public String getType() {
		return type;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setDateValue(Date date) {
		this.dateValue = date;
	}

	public void setStringValue(String string) {
		this.stringValue = string;
	}

	public void setIntValue(int i) {
		intValue = i;
	}

	public void setLongValue(long l) {
		longValue = l;
	}

	public Double getDoubleValue() {
		return doubleValue;
	}

	public void setDoubleValue(Double doubleValue) {
		this.doubleValue = doubleValue;
	}
	
}
